Skip to content

BUG: Easter works incorrectly in negative offsets #7195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented May 21, 2014

When an offset is negative, Easter skips the date just before and returns one before.

(- pd.offsets.Easter()).apply(pd.Timestamp('2011-01-01 09:00:00'))
#2009-04-12 00:00:00

(- pd.offsets.Easter()).apply(pd.Timestamp('2012-01-01 09:00:00'))
# returns 2010-04-04 00:00:00

(- pd.offsets.Easter()).apply(pd.Timestamp('2010-04-05 09:00:00'))
#2009-04-12 00:00:00

@jreback jreback added this to the 0.14.1 milestone May 21, 2014
@jreback
Copy link
Contributor

jreback commented May 21, 2014

this just Easter or a more general holiday apply issue?

@sinhrks
Copy link
Member Author

sinhrks commented May 24, 2014

Other offset looks handle negative offsets correctly. I'll check other offsets during #7156.

jreback added a commit that referenced this pull request Jun 3, 2014
BUG: Easter works incorrectly in negative offsets
@jreback jreback merged commit 97ad707 into pandas-dev:master Jun 3, 2014
@jreback
Copy link
Contributor

jreback commented Jun 3, 2014

thanks

@sinhrks sinhrks deleted the easter branch June 5, 2014 12:44
new = easter(other.year + self.n)
elif other < currentEaster:
new = easter(other.year + self.n - 1)
if self.n >= 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants